<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑题库</title>
</head>
<body>
<script type="text/html" id="form">
    <input type="hidden" name="id" value="{{ d.id }}" />
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                <div class="layui-form-item">
                    <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>角色名称</label>
                    <div class="layui-input-block">
                        <input type="text"  name="name" lay-verify="required" value="{{d.name}}" autocomplete="off" placeholder="请输入角色名称" class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">图示</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="icon"
                             data-accept="image"
                             data-type="ali-oss"
                             data-uploaded="{{ d.icon }}"
                             data-uploadedId="{{ d.icon }}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">大图</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="img"
                             data-accept="image"
                             data-type="ali-oss"
                             data-width="1000"
                             data-height="1400"
                             data-uploaded="{{ d.img }}"
                             data-uploadedId="{{ d.img }}"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><text style="color:red;">*</text>分类</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="category"
                             data-sourceType="data"
                             data-radio="true"
                             data-source="[{name:'联动',value:'联动'},{name:'SP',value:'SP'},{name:'SSR',value:'SSR'},{name:'SR',value:'SR'},{name:'R',value:'R'},{name:'N',value:'N'}]"
                             data-layVerify="required"
                             data-selected="{{=d.category}}"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><text style="color:red;">*</text>品质</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="quality"
                             data-sourceType="data"
                             data-radio="true"
                             data-source="[{name:'SP',value:'SP'},{name:'SSR',value:'SSR'},{name:'SR',value:'SR'},{name:'R',value:'R'},{name:'N',value:'N'}]"
                             data-layVerify="required"
                             data-selected="{{=d.quality}}"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>定位</label>
                    <div class="layui-input-block">
                        <input type="text" name="position" lay-verify="required" value="{{d.position}}" autocomplete="off" placeholder="请输入定位" class="layui-input">
                    </div>
                </div>


                <blockquote class="layui-elem-quote">基础属性</blockquote>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">满级攻击</label>
                        <div class="layui-input-inline">
                            <input type="number" name="max_attack" value="{{ d.max_attack }}"  lay-verify="required|number" autocomplete="off" placeholder="请输入数值" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">满级生命</label>
                        <div class="layui-input-inline">
                            <input type="number" name="max_life" value="{{ d.max_life }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">满级防御</label>
                        <div class="layui-input-inline">
                            <input type="number" name="max_defense" value="{{ d.max_defense }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">满级速度</label>
                        <div class="layui-input-inline">
                            <input type="number" name="max_speed" value="{{ d.max_speed }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">满级暴击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="max_crit" value="{{ d.max_crit }}" lay-verify="required" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">1级攻击</label>
                        <div class="layui-input-inline">
                            <input type="number" name="min_attack" value="{{ d.min_attack }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">1级生命</label>
                        <div class="layui-input-inline">
                            <input type="number" name="min_life" value="{{ d.min_life }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">1级防御</label>
                        <div class="layui-input-inline">
                            <input type="number" name="min_defense" value="{{ d.min_defense }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">1级速度</label>
                        <div class="layui-input-inline">
                            <input type="number" name="min_speed" value="{{ d.min_speed }}" lay-verify="required|number" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">1级暴击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="min_crit" value="{{ d.min_crit }}" lay-verify="required" autocomplete="off" placeholder="请输入数值"  class="layui-input point1">
                        </div>
                    </div>
                </div>

                <blockquote class="layui-elem-quote">评级</blockquote>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒前攻击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="before_attack_grade" value="{{ d.before_attack_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒前攻击" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒前生命</label>
                        <div class="layui-input-inline">
                            <input type="text" name="before_life_grade" value="{{ d.before_life_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒前生命"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒前防御</label>
                        <div class="layui-input-inline">
                            <input type="text" name="before_defense_grade" value="{{ d.before_defense_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒前防御" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒前速度</label>
                        <div class="layui-input-inline">
                            <input type="text" name="before_speed_grade" value="{{ d.before_speed_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒前速度"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒前暴击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="before_crit_grade" value="{{ d.before_crit_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒前暴击"  class="layui-input point1">
                        </div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒后攻击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="after_attack_grade" value="{{ d.after_attack_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒后攻击" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒后生命</label>
                        <div class="layui-input-inline">
                            <input type="text" name="after_life_grade" value="{{ d.after_life_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒后生命"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒后防御</label>
                        <div class="layui-input-inline">
                            <input type="text" name="after_defense_grade" value="{{ d.after_defense_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒后防御" class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒后速度</label>
                        <div class="layui-input-inline">
                            <input type="text" name="after_speed_grade" value="{{ d.after_speed_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒后速度"  class="layui-input point1">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label two-part-label">觉醒后暴击</label>
                        <div class="layui-input-inline">
                            <input type="text" name="after_crit_grade" value="{{ d.after_crit_grade }}" lay-verify="required" autocomplete="off" placeholder="请输入觉醒后暴击"  class="layui-input point1">
                        </div>
                    </div>
                </div>


                <blockquote class="layui-elem-quote">版本就业</blockquote>

                <div class="layui-form-item">
                    <label class="layui-form-label">PVP</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="pvp"
                             data-sourceType="data"
                             data-source="[{name:'斗技',value:'斗技'},{name:'道馆进攻',value:'道馆进攻'},{name:'道馆防守',value:'道馆防守'},{name:'突破',value:'突破'},{name:'道馆',value:'道馆'},{name:'对弈',value:'对弈'}]"
                             data-selected="{{=d.pvp}}"
                             data-radio="false"
                             data-max="3"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">PVE</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="pve"
                             data-sourceType="data"
                             data-source="[{name:'业原火',value:'业原火'},{name:'土蜘蛛',value:'土蜘蛛'},{name:'鬼灵歌姬',value:'鬼灵歌姬'},{name:'全面就业',value:'全面就业'},{name:'日轮之陨',value:'日轮之陨'},{name:'魂土',value:'魂土'},{name:'御魂',value:'御魂'},{name:'探索',value:'探索'},{name:'秘闻',value:'秘闻'},{name:'地鬼',value:'地鬼'},{name:'活动',value:'活动'},{name:'逢魔',value:'逢魔'}]"
                             data-selected="{{=d.pve}}"
                             data-radio="false"
                             data-max="3"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <input type="text"   name="desc" value="{{d.desc}}" autocomplete="off" placeholder="请输入描述" class="layui-input">
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="laytp-form">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</script>
<form class="layui-form" lay-filter="layui-form"></form>
<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'],function(){
        let form = layui.form;
        let $ = layui.jquery;
        //获取参数ID
        var id = facade.getUrlParam('id');
        if(!id){
            facade.error('参数ID不能为空');
            return false;
        }

        //获取数据，渲染到对应的节点上
        facade.ajax({
            route: "/admin.yys.role/info",
            data: {id: id},
            successAlert: false,
            showLoading: true
        }).done(function(res){
            if(res.code === 0){
                layui.laytpl($("#form").html()).render(res.data,function(string){
                    $("form").html(string);
                    layui.laytpForm.render();
                    form.render();
                });
            }
        });

        form.on('submit(laytp-form)', function(data){
            var btnAnim = layui.button.load({elem:$(this)});
            facade.ajax({
                route:'/admin.yys.role/edit',
                data:data.field
            }).done(function(res){
                if(res.code === 0){
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function(){
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>